//
//  UIView+IBExtension.swift
//  YYWeibo
//
//  Created by strongwallyi on 15/12/27.
//  Copyright © 2015年 strongwallyi. All rights reserved.
//

import UIKit

extension UIView{
    
    //圆角
    @IBInspectable var cornerRadius: CGFloat{
        
        get{
            return layer.cornerRadius
        }
        set{
            layer.cornerRadius = newValue
            layer.masksToBounds = (cornerRadius > 0)
        }
    }
    
    //边界
    @IBInspectable var borderWidth: CGFloat{
        
        get{
            
            return layer.borderWidth
            
        }
        
        set{
            
            layer.borderWidth = newValue
        }
    }
    
    //颜色
    @IBInspectable var borderColor: UIColor? {
        
        get{
            guard let c = layer.borderColor else{
                return nil
            }
            return UIColor(CGColor: c)
        }
        
        set{
            layer.borderColor = newValue?.CGColor
        }
        
    }
    
    
}
